<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('混凝土信息登记')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <label>商混站名：</label>-->
<!--                                <input type="text" name="mixingStation"  style="width: 150px;"/>-->
<!--                            </li>-->
                            <li>
                                <label>车牌号码：</label>
                                <input type="text" name="plateNo" style="width: 90px;"/>
                            </li>
                            <li>
                                <label>工作日期：</label>
                                <input type="text" class="time-input" placeholder="选择工作日期" name="workDate" style="width: 110px;"/>
                            </li>
                            <li>
                                <label>绑定状态：</label>
                                <select name="bindState"  style="width: 110px;">
                                    <option value="">全部</option>
                                    <option value="0">未绑定</option>
                                    <option value="1">绑定</option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="concrete:register:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary" onclick="complementRegisterInfo()">
                    <i class="fa fa-external-link"></i> 补录
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="concrete:register:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
<!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="concrete:register:export">-->
<!--                    <i class="fa fa-download"></i> 导出-->
<!--                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('concrete:register:edit')}]];
        var removeFlag = [[${@permission.hasPermi('concrete:register:remove')}]];
        var prefix = ctx + "concrete/register";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "混凝土信息登记",
                columns: [
                {
                    field: 'plateNo',
                    title: '车牌号码'
                },
                {
                    field: 'concreteType',
                    title: '混凝土标号'
                },
                {
                    field: 'concreteVolume',
                    title: '方量(m³)'
                },

                {
                    field: 'companyName',
                    title: '公司名称'
                },
                {
                    field: 'mixingStation',
                    title: '商混站名'
                },
                {
                    field: 'machineUnit',
                    title: '机组编号'
                },
                {
                    field: 'slumpStart',
                    title: '起始坍落度mm'
                },
                {
                    field: 'slumpEnd',
                    title: '工地坍落度mm'
                },
                {
                    field: 'workDate',
                    title: '工作日期'
                },
                {
                    field: 'bindState',
                    title: '绑定状态',
                    formatter(value) {
                        let actions = [];
                        if (value === '0') {
                            actions.push('<span class="badge badge-warning">未绑定</span>');
                        } else {
                            actions.push('<span class="badge badge-primary">已绑定</span>');
                        }
                        return actions.join('');
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.registerId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.registerId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function complementRegisterInfo() {
            //跳转全屏窗口，查询没有注册信息的工作序列 todo 权限也得考虑啊，不能看到所有的车辆。
            $.modal.openTab('信息补录', "/concrete/register/complement");
        }
    </script>
</body>
</html>